let salaries = {
    "John": 100,
    "Pete": 300,
    "Mary": 250
};

function topSalary(salaries) {
    if (salaries == null) {
        return null;
    }
    let max = 0;
    let retName = '';
    for (let [name, value] of Object.entries(salaries)) {
        if (value > max) {
            max = value;
            retName = name;
        }
    }
    return retName;
}

alert(topSalary(salaries));